import { assetDetail } from '@/pages/api/index.js'
export default {
		 data() {
		  return {
          dataList:[],
          form:{
            startTime:"",
            endTime:'',
            pageSize:10,
            pageIndex:1,
          },
          time:[],      //选择日期绑定的时间，以数组展示
          count:0,
          userMoney:0, //余额
		  }
		},
		methods: {
        search(){
           this.form = {
               startTime:this.time[0],
               endTime:this.time[1],
               pageSize:10,
               pageIndex:1
           }
           this.init()
        },
        //初始化数据
        init(){
          console.log(this.form,'form')
          assetDetail(this.form).then(res=>{
            console.log(res.data,1)
            res.data.detail.forEach(item=>{
                 if(item.type=='支付宝充值' || item.type == '银联充值'){
                       item.money = `+${item.money}`
                 }else{
                       item.money = `-${item.money}`
                 }
            })
            this.dataList = res.data.detail
            console.log(res.data,'2')
            this.count = res.data.count
            this.userMoney = res.data.userMoney
          })
        },
        handleSizeChange(val) {
          console.log(`每页 ${val} 条`);
          this.form.pageSize = val
          this.init()
        },
        handleCurrentChange(val) {
          console.log(`当前页: ${val}`);
          this.form.pageIndex = val
          this.init()
        },
        location(){
            this.$router.push('/recharge')
        }
      },
      created(){
           this.init()
      }
	}
